<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    .box {
      width: 500px;
      height: 500px;
      background-color: #ccc;
      color: #fff;
      text-align: center;
      font-size: 100px;
      /* 禁止用户选中 */
      user-select: none;
    }
  </style>
</head>

<body>
  <div class="box">1</div>

  <!-- 导入 lodash.min.js -->
  <script src="./lodash.min.js"></script>
  <script>

    // 需求1: 点击box，让里面的值 +1
    let num = 1;
    let box = document.querySelector('.box');
    // 把函数抽离
    function fn() {
      box.innerHTML = ++num;
    }

    // // 简单实现
    // box.addEventListener('mousemove', fn );

    // 节流实现: 单位时间内多次触发，以第一次为基准;
    // _.throttle(func, [wait=0])
    box.addEventListener('mousemove', _.throttle(fn, 1000));

  </script>
</body>

</html>